package com.example.java3s1.dao;

import com.example.java3s1.entity.Person;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;
@Component
@Data
public class MemoryDatabase {

    private List<Person> persons = new ArrayList<>();
    @Value("${lock:true}")
    private Boolean lock;
    @Value("${dirPath}")
    private String dir;
    @PostConstruct
    public void init(){
        System.out.println(dir);
        Person person= new Person();
        person.setSex(true);
        person.setName("lucy");
        person.setAge(15);
        persons.add(person);
        persons.add(new Person(){{
            setAge(10);
            setName("tommy");
            setSex(false);
        }});
        persons.add(new Person(){{
            setAge(34);
            setName("tony");
            setSex(false);
        }});

    }
}
